package com.zr.gdms.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zr.gdms.model.Score;
import com.zr.gdms.service.ScoreSelectStudentSrevice;
import com.zr.gdms.serviceimpl.ScoreSelectStudentSreviceimpl;

import net.sf.json.JSONObject;

public class ScoreSelectStudentController extends HttpServlet {
	ScoreSelectStudentSrevice ss=new ScoreSelectStudentSreviceimpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	/**
	 * 根据成绩分段查询学生信息
	 * */
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		req.setCharacterEncoding("utf8");
		resp.setCharacterEncoding("utf8");
		HttpSession session=req.getSession();
		PrintWriter pt=resp.getWriter();
		int score1=Integer.parseInt(req.getParameter("score1"));
		int score2=Integer.parseInt(req.getParameter("score2"));		
		int page=Integer.parseInt(req.getParameter("page"));
		int rows=Integer.parseInt(req.getParameter("rows"));
		Score sc=new Score();
		JSONObject j=ss.getScoreStudents(sc.getSid(), score1, score2, page, rows);		
		pt.write(j.toString());
		pt.flush();
		pt.close();	
	}
	
}
